﻿using Microsoft.Extensions.Caching.Distributed;

namespace Hotel.Repositories
{
    public interface IDistributedCache<TItem> where TItem : class
    {
        /// <summary>
        /// 缓存方法，默认有效期2小时
        /// </summary>
        /// <param name="Key"></param>
        /// <param name="Value"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        Task<List<TItem>> GetOrAddAsync(string Key, Func<Task<List<TItem>>> Value, DistributedCacheEntryOptions options = null);
    }
}